package com.shj.service.impl;

import com.shj.dao.SysPolicyMapper;
import com.shj.entity.SysPolicy;
import com.shj.service.SysPolicyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysPolicyServiceImpl implements SysPolicyService {

    @Autowired
    private SysPolicyMapper sysPolicyMapper;

    @Override
    public List<SysPolicy> findAll() {
        return sysPolicyMapper.findAll();
    }

    @Override
    public SysPolicy findByYear(String year) {
        return sysPolicyMapper.selectByPrimaryKey(year);
    }

    @Override
    public void add(SysPolicy sysPolicy) {
        sysPolicyMapper.insert(sysPolicy);
    }

    @Override
    public void edit(SysPolicy sysPolicy) {
        sysPolicyMapper.updateByPrimaryKey(sysPolicy);
    }

    @Override
    public void delete(String year) {
        sysPolicyMapper.deleteByPrimaryKey(year);
    }
}
